import common from './common'
import paths from './paths'

const ytgzBase = window.config.VUE_APP_REPORT_URL || ''
const ytgzPath = {
  addHandlerApprove: ytgzBase + 'product/project/report/auto/addHandle/approve',
  saveDataApprove: ytgzBase + 'product/project/report/auto/save/data'
}
const taskDelayService = {};
(function (service) {
  service.normalRequest = function (data) {
    return common.post(paths.taskDelay.normalRequest, {}, data)
  }
  service.addHandlerApprove = function(params, data) {
    return service.normalRequest({
      url: ytgzPath.addHandlerApprove,
      method: 'post',
      params: params,
      body: data
    })
  }
  service.saveDataApprove = function(params, data) {
    return service.normalRequest({
      url: ytgzPath.saveDataApprove,
      method: 'post',
      params: params,
      body: data
    })
  }
  service.createTaskDelay = function (data) {
    return common.post(paths.taskDelay.create, {}, data)
  }

  // 创建任务下发的延时任务
  service.createSubmitProcessTaskDelay = function (handlerId, detail) {
    return service.createTaskDelay({
      taskType: 1,
      objectId: handlerId,
      objectType: 1,
      detail: detail
    })
  }
})(taskDelayService)
export default taskDelayService
